/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package action;

import controller.Action;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.IIOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author Cristian
 */
public class DepositoAction implements Action {

    @Override
    public void execute(HttpServletRequest request, HttpServletResponse response, Integer contaLogada) throws IIOException {
     
        Integer numeroConta = null;
        if(contaLogada.equals("")){
            String numeroContaa = request.getParameter("numeroConta");
            contaLogada = Integer.parseInt(numeroContaa);
            numeroConta = contaLogada;
        }else{
           numeroConta = contaLogada;
        }
        
        try {
            request.setAttribute("numeroConta", numeroConta);
            RequestDispatcher dispatcher = request.getRequestDispatcher("realizarDeposito.jsp");
            dispatcher.forward(request, response);
        } catch (ServletException ex) {
            Logger.getLogger(SaqueAction.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(SaqueAction.class.getName()).log(Level.SEVERE, null, ex);
        }
    }  
}
